<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>


    <meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>TabView Integration</title>

<style type="text/css">
/*margin and padding on body element
  can introduce errors in determining
  element position and are not recommended;
  we turn them off as a foundation for YUI
  CSS treatments. */
body {
	margin:0;
	padding:0;
}
</style>

<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
<link rel="stylesheet" type="text/css" href="../../build/tabview/assets/skins/sam/tabview.css" />
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
<script type="text/javascript" src="../../build/element/element-min.js"></script>
<script type="text/javascript" src="../../build/tabview/tabview-min.js"></script>
<script type="text/javascript" src="../../build/datasource/datasource-min.js"></script>
<script type="text/javascript" src="../../build/event-delegate/event-delegate-min.js"></script>
<script type="text/javascript" src="../../build/datatable/datatable-min.js"></script>

<!--there is no custom header content for this example-->

</head>

<body class="yui-skin-sam">


<h1>TabView Integration</h1>

<div class="exampleIntro">
	<p>Integrating DataTable with the TabView widget.</p>
			
</div>

<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->


<div id="tvcontainer" class="yui-navset">
    <ul class="yui-nav">
        <li class="selected"><a href="#tab1"><em>Start Tab</em></a></li>
        <li><a href="#tab2"><em>DataTable Tab</em></a></li>
        <li><a href="#tab3"><em>Another Tab</em></a></li>

    </ul>            
    <div class="yui-content">

        <div><p>Welcome! There is a DataTable in the second Tab.</p></div>
        <div id="dtcontainer"></div>
        <div><p>This is another Tab.</p></div>
    </div>
</div>

<script type="text/javascript" src="assets/js/data.js"></script>
<script type="text/javascript">
YAHOO.util.Event.addListener(window, "load", function() {
    YAHOO.example.TabView = function() {

        var myColumnDefs = [
            {key:"id", sortable:true},
            {key:"date", formatter:YAHOO.widget.DataTable.formatDate, sortable:true, sortOptions:{defaultDir:YAHOO.widget.DataTable.CLASS_DESC}},
            {key:"quantity", formatter:YAHOO.widget.DataTable.formatNumber, sortable:true},
            {key:"amount", formatter:YAHOO.widget.DataTable.formatCurrency, sortable:true},
            {key:"title", sortable:true},
            {key:"description"}
        ];

        var myDataSource = new YAHOO.util.DataSource(YAHOO.example.Data.bookorders);
        myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
        myDataSource.responseSchema = {
            fields: ["id","date","quantity","amount","title","description"]
        };
        
        var myDataTable = 
                new YAHOO.widget.DataTable("dtcontainer", myColumnDefs, myDataSource,{scrollable:true,width:"100%"});
                
        var myTabView = new YAHOO.widget.TabView("tvcontainer");
        myTabView.getTab(1).addListener("click", function() {myDataTable.onShow()});        

        return {
            oDS: myDataSource,
            oDT: myDataTable,
            oTV: myTabView
        };
    }();
});
</script>





<!--END SOURCE CODE FOR EXAMPLE =============================== -->

</body>
</html>
